{extend name="/fool" /}
{block name="css"}
<link rel="stylesheet" href="/css/admin/product_list.css">
<style>
    .layui-form-onswitch{
        /*background: #1989FA;*/
        /*border-color: #1989FA;*/
    }
    .layui-upload-img{
        height:200px;
        width:200px;
        margin: 10px;
    }
    .value{
        text-align: left;
    }
</style>
{/block}
{block name="menu_content"}
<form class="layui-form" action="" method="post" enctype="multipart/form-data">
    <ul id="content">
        <li class="li">
            <table class="one">
                <tr>
                    <td class="one-one">服务中心名称：</td>
                    <td class="value">
                        <div class="layui-input-inline">
                            <input type="text" required name="name" autocomplete="off" class="layui-input" placeholder="输入服务中心名称">
                        </div>
                    </td>
                </tr>
                <tr>
                    <td class="one-one">是否运营：</td>
                    <td class="value">
                        <div style="margin-left:0;" class="layui-input-block">
                            <input type="radio" name="status" value="1" title="是">
                            <input type="radio" name="status" value="2" title="否">
                        </div>
                    </td>
                </tr>
                <tr>
                    <td class="one-one">绑定服务中心用户：</td>
                    <td class="value">
	                    <div class="layui-input-inline">
	                        <input type="text" name="" autocomplete="off" id="jtnumtp" class="layui-input" placeholder="用户账号">
	                    </div>
	                    <button type="button" class="layui-btn sstp">搜索</button>
	                    <div class="layui-input-inline" id="sstp">
	                    	<input name="bduser_id" class="bd" type="hidden">
	                        <input type="text" name="bduser_id" class="layui-input" disabled style="background:#e7e7e7;">
	                    </div>
                    </td>
                </tr>
                <tr>
                    <td class="one-one">推荐人用户：</td>
                    <td class="value">
	                    <div class="layui-input-inline">
	                        <input type="text" name="" autocomplete="off" id="tjjtnumtp" class="layui-input" placeholder="用户账号">
	                    </div>
	                    <button type="button" class="layui-btn tjsstp">搜索</button>
	                    <div class="layui-input-inline" id="tjsstp">
	                    	<input name="tjuser_id" class="tj" type="hidden">
	                        <input type="text" name="" class="layui-input" disabled style="background:#e7e7e7;">
	                    </div>
                    </td>
                </tr>
                <tr>
                    <td class="one-one">
                        <button type="button" class="listbu layui-btn">取消</button>
                    </td>
                    <td class="value">
                        <button type="submit" class="fh layui-btn">保存</button>
                    </td>
                </tr>
            </table>
        </li>
    </ul>
</form>

<!-- 配置文件 -->
<script type="text/javascript" src="/utf8-php/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/utf8-php/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('container',{
        initialFrameHeight: 300,
        initialFrameWidth: 500
    });
</script>


<script>
</script>
<script>
	$(".tjsstp").click(function(){
        var num = $("#tjjtnumtp").val();
        if(num.length>1){
            $.post("{:url('upssss')}",{username:num},function(res){
                	console.log(res);
	                $("#tjsstp").find('input').val(res.list.name);
	                $(".tj").val(res.list.id);
            },'json')
        }else{
            $("#tjsstp").find('input').val('');
        }
    })
    $(".sstp").click(function(){
        var num = $("#jtnumtp").val();
        if(num.length>1){
            $.post("{:url('upssss')}",{username:num},function(res){
                	console.log(res);
	                $("#sstp").find('input').val(res.list.name);
	                $(".bd").val(res.list.id);
            },'json')
        }else{
            $("#ss").find('input').val('');
        }
    })
    layui.use(['upload','jquery'], function(){
        var $ = layui.jquery;
        var upload = layui.upload;
        //普通图片上传
        var uploadInst = upload.render({
            elem: '#test1'
            ,url: "{:url('images')}"
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#demo1').attr('src', result); //图片链接（base64）
                });
            }
            ,done: function(res){
                //如果上传失败
                console.log(res);
                $("#image").val(res);
                if(res.code > 0){
                    return layer.msg('上传失败');
                }
                //上传成功
            }
            ,error: function(){
                //演示失败状态，并实现重传
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function(){
                    uploadInst.upload();
                });
            }
        });
        //多图片上传
        upload.render({
            elem: '#test2'
            ,url: "{:url('imagesdt')}"
            ,multiple: true
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#demo2').append('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
                });
            }
            ,done: function(res){
                var val = $("#images").val();
                $("#images").val(val + res + '%');
                //上传完毕
            }
        });
    });
    layui.use('form', function(){
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function(data){
            layer.msg(JSON.stringify(data.field));
            return false;
        });
    });
    layui.use('layedit', function(){
        var layedit = layui.layedit;
        layedit.build('demo',{
            uploadImage:{}
        }); //建立编辑器
        layedit.set({
            uploadImage: {
                url: "{:url('images')}" //接口url
                ,type: 'post' //默认post
                ,done: function(res){
                    console.log(res);
                    //如果上传失败
                    if(res.code > 0){
                        return layer.msg('上传失败');
                    }
                    //上传成功
                }
            }
        });
        var layeditDemo= layedit.build('demo');
        $(" .layui-layedit .layui-unselect.layui-layedit-tool")
            .append('<i class="layui-icon layedit-tool-preview" title="预览"  style="font-size:18px"></i>');
        $(document).on('click','.layedit-tool-preview',function(data){
            parent.layer.open({
                title: '在线预览'
                , shade: 0.2
                ,move: false
                ,content: layedit.getContent(layeditDemo)
                ,offset: 'rt'
                ,area: ['1000px',(top.window.innerHeight*0.80 + 'px').toString()]
            });
        });
    });
    $(".listbu").click(function(){
        history.back(-1);
    })
</script>
{/block}